<?php
use backend\assets\AgentAsset;
use yii\bootstrap\ActiveForm;
use yii\helpers\Html;

AgentAsset::register($this);
?>
<style>
	.adBody {padding: 0 30px;}
	.adBody .adBody-list{float: left;width: 247px;margin-bottom: 20px;}
	.adBody .adBody-list:nth-child(odd) {margin-right: 56px;}
	.adBody .adBody-list .name{width: 67px;display: inline-block;text-align: right;margin-right: 10px;}
	.adBody input[type="text"] { height: 34px;}
	.adBody .select {width: 165px;}
	.myclass .n-icon{
		display: none !important;
	}
	.form_position{
		position: relative;
		top:40px;
		margin: 0 80px;
	}
	.form-group{
		padding-bottom:20px;
		margin-bottom: 6px !important;
	}
	.tab_position{
		bottom: 30px;
	}

</style>

<div class="hide"><iframe name='send_post' id='send_post'></iframe></div>
<?php $form=ActiveForm::begin(['options'=>['target'=>'send_post','name'=>'register']]);?>
<div class="clearfix" style="margin-top: 30px">
	<div class="adBody clearfix">
		<div class="adBody-list form-group">
			<span class="name"><em class="red">*</em>商品名称</span><span><input type="text" name="repertory_name"/></span>
		</div>
		<div class="adBody-list form-group">
			<span class="name">条形码</span>
			<span><input type="text" name="bar_code" datatype="*"/></span>
		</div>

		<?php if($this->userinfo->user_type == 3){?>
		<div class="adBody-list  form-group">
			<span class="name">成本价</span><span><input type="text" name="goods_cost_price" datatype="*"/></span>
		</div>
		<?php }?>

			<div class="adBody-list form-group">
				<span class="name">零售价</span>
				<span><input type="text" name="goods_sell_price" datatype="*"/></span>
			</div>
			
		<div class="adBody-list form-group">
			<span class="name">家居产品</span><span><div class="select">
					<select name="is_sell">
						<option value="1">是</option>
						<option value="0">不是</option>
					</select>
				</div>
				        </span>
		</div>
			<div class="adBody-list form-group">
				<span class="name">规格</span>
				        <span>
										<div class="select">
											<select name="repertory_specs">
												<option value=""> </option>
												<?php foreach ($specs as $sp){ ?>
													<option value="<?=Html::encode($sp->config_val)?>"><?=Html::encode($sp->config_val)?></option>
												<?php }?>
											</select>
										</div>
				        </span>
			</div>
			<div class="adBody-list form-group">
				<span class="name">品牌</span><span><div class="select">
						<select name="repertory_brand">
							<option value=""> </option>
							<?php foreach ($brand as $b){ ?>
								<option value="<?=Html::encode($b->config_val)?>"><?=Html::encode($b->config_val)?></option>
							<?php }?>
						</select>
					</div>
				        </span>
			</div>
			<div class="adBody-list form-group">
				<span class="name">系列</span>
				        <span><div class="select">
								<select name="repertory_series">
									<option value=""> </option>
									<?php foreach ($series as $se){ ?>
										<option value="<?=Html::encode($se->config_val)?>"><?=Html::encode($se->config_val)?></option>
									<?php }?>
								</select>
							</div>
				        </span>
			</div>
			
			<div class="adBody-list form-group">
				<span class="name">类别</span><span><div class="select">
						<select name="repertory_category">
							<option value=""> </option>
							<?php foreach ($category as $c){ ?>
								<option value="<?=Html::encode($c->config_val)?>"><?=Html::encode($c->config_val)?></option>
							<?php }?>
						</select>
					</div>
				        </span>
			</div>
			<div class="adBody-list form-group">
				<span class="name">供应商</span>
				        <span>
								<div class="select">
									<select name="supplier_name">
										<option value=""> </option>
										<?php foreach ($supplier as $s){ ?>
											<option value="<?=Html::encode($s->config_val)?>"><?=Html::encode($s->config_val)?></option>
										<?php }?>
									</select>
								</div>
				        </span>
			</div>
	    </div>
	</div>

	<div class="text-center tab_position">
		<span class="btnBg" style=" color: #fff;border-radius: 6px; ">
			<input type="submit" value="确定" style="display: block; width: 100%; background: 0; border:0;line-height: 36px;">
		</span>
		<span class="btnBg ml20 bg_rest " style=" color: #fff;border-radius: 6px;">
			<input type="reset" value="取消" style="display: block; width: 100%; background: 0;line-height: 36px; " />
		</span>
	</div>

	<?php ActiveForm::end();?>
	<?php $this->beginBlock('js_index_end') ?>
	$('form[name="register"]').validator({
	focusCleanup: true,
	stopOnError:false,
	//debug: true,
	timely: 2,
	//自定义规则（PS：建议尽量在全局配置中定义规则，统一管理）
	rules: {
	},
	msgClass: "n-bottom myclass",
	fields: {
	'repertory_name':{
	rule:"required;length[~20]",
	tip:'请填商品名称',
	},
	},
	});
	$(function(){
	$('input[type="reset"]').click(function(){
	var index = parent.layer.getFrameIndex(window.name);
	parent.layer.close(index);
	})
	})
	<?php $this->endBlock() ?>
	<?php $this->registerJs($this->blocks['js_index_end'], $this::POS_END); ?>

		
